package cn.com.nes.site.entity.em.crm.clue;

import cn.com.nes.common.exception.NoSuchEnumException;

import java.util.HashMap;
import java.util.Map;

/**
 * 线索阶段 枚举
 *  值域对应 t_param 表 param_type=10
 */
public enum ClueStageEnum {

    NEW("01", "新线索"),
    CLEAR_INTENTION("02", "明确意向"),
    ADD_WECHAT("03", "加微信"),
    TO_OPPORTUNIY("04", "转商机"),
    NULLITY("05", "无效"),

    ;

    private String key;

    private String value;

    ClueStageEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static ClueStageEnum getEnum(String key) {
        Map<String, ClueStageEnum> map = new HashMap<>();
        for (ClueStageEnum cluePoolEntryEnum : values()) {
            map.put(cluePoolEntryEnum.getKey(), cluePoolEntryEnum);
        }
        if (!map.containsKey(key)) {
            throw new NoSuchEnumException("未匹配的线索阶段类型");
        }
        return map.get(String.valueOf(key));
    }

}
